<template>
    <div class="seller-container">
        <div class="seller-scroll">
            <div class="seller-store">
                <div class="seller-store-left">
                    <div>{{ sellerData.name }}</div>
                    <div>
                        <van-rate
                            v-model="sellerData.score"
                            allow-half
                            void-icon="star"
                            void-color="#eeeeee"
                            color="#ff9a01"
                        />月售{{ sellerData.sellCount }}单
                    </div>
                </div>
                <div class="seller-store-right">
                    <van-icon name="like" color="#ff3300" />
                    <p>已收藏</p>
                </div>
            </div>
            <van-divider />
            <div class="seller-information">
                <div class="seller-information-content">
                    <span>起送价</span>
                    <span
                        ><strong>{{ sellerData.minPrice }}</strong
                        >元</span
                    >
                </div>
                <div class="seller-information-content">
                    <span>商家配送</span>
                    <span
                        ><strong>{{ sellerData.deliveryPrice }}</strong
                        >元</span
                    >
                </div>
                <div class="seller-information-content">
                    <span>平均配送时间</span>
                    <span
                        ><strong>{{ sellerData.deliveryTime }}</strong
                        >元</span
                    >
                </div>
            </div>
            <div class="seller-activity">
                <h2>活动与公告</h2>
                <div>{{ sellerData.bulletin }}</div>
            </div>
            <van-divider />
            <div class="seller-supports">
                <div v-for="item in sellerData.supports" :key="item">
                    {{ item }}
                </div>
            </div>
        </div>
    </div>
</template>

<script lang="ts">
interface ISeller {
    avatar?: string; //头像
    bulletin?: string; //公告
    date?: Array<string>; //营业时间
    deliveryPrice?: number; //配送费
    deliveryTime?: number; //配送时间
    description?: string; //配送描述
    id?: number; //id
    minPrice?: number; //起送费
    name?: string; //商店名
    pics?: Array<string>; //图片组
    score?: number; //评分
    sellCount?: number; //销量
    supports?: Array<string>; //公告
}
import { $_shopSeller } from "@/apis/goods";
import { Component, Vue } from "vue-property-decorator";

@Component
export default class Seller extends Vue {
    supports: Array<string> = [];
    sellerData: ISeller = {};

    async created(): Promise<void> {
        let res = await $_shopSeller();
        console.log(res.data);
        this.sellerData = res.data;
        this.supports = res.data.supports;
    }
    get comSupports() {
        return this.supports.map((item) => item).join(",");
    }
}
</script>

<style scoped lang="scss">
.van-divider {
    margin: 0;
}
.seller-container {
    display: flex;
    flex-direction: column;
    .seller-scroll {
        overflow: scroll;
        height: 100%;
        padding-bottom: 110px;
        .seller-store {
            display: flex;
            background: #ffffff;
            height: 97px;
            justify-content: space-around;
            padding-bottom: 8px;
            .seller-store-left {
                display: flex;
                flex-direction: column;
                justify-content: space-evenly;
            }
            .seller-store-right {
                display: flex;
                flex-direction: column;
                justify-content: space-evenly;
                align-items: center;
                .van-icon-like:before {
                    font-size: 25px;
                }
            }
        }
        .van-divide {
            background: #999;
            margin: 0;
            height: 50px;
        }
        .seller-information {
            display: flex;
            justify-content: space-evenly;
            height: 102px;
            background: #fff;
            align-items: center;
            margin-bottom: 30px;
            .seller-information-content {
                display: flex;
                flex-direction: column;
                color: #ccc;
                span {
                    strong {
                        font-size: 26px;
                        color: #000;
                    }
                }
            }
        }
        .seller-activity {
            background: #fff;
            padding: 20px;
            h2 {
                margin-bottom: 18px;
            }
            div {
                color: red;
            }
        }
        .seller-supports {
            background: #fff;
            padding-left: 20px;
            div {
                margin-top: 20px;
            }
        }
    }
}
</style>